<template>
	<view>
		<view class="model-border" style="display: flex;align-items: center;">
			<view class="title"></view>
			<text class="icon-title">信息录入</text>
		</view>
		<view class="content">
			<view class="content_text">
				<text>企业名称</text>
				<text style="color: red;">*</text>
			</view>
			<u-input class="content-input" v-model="form.name" :clearable="false" placeholder="请输入企业名称" type="number" />
		</view>
		<view class="content">
			<view class="content_text">
				<text>企业类型</text>
				<text style="color: red;">*</text>
			</view>
			<u-input class="content-input" v-model="form.enterprise_type" :clearable="false" placeholder="请输入企业类型" type="number" />
		</view>
		<view class="content">
			<view class="content_text">
				<text>负责人</text>
				<text style="color: red;">*</text>
			</view>
			<u-input class="content-input" v-model="form.responsibility_name" :clearable="false" placeholder="请输入负责人" type="number" />
		</view>
		<view class="content">
			<view class="content_text">
				<text>负责人电话</text>
				<text style="color: red;">*</text>
			</view>
			<u-input class="content-input" v-model="form.responsibility_phone" :clearable="false" placeholder="请输入负责人电话" type="number" />
		</view>
		<view class="content">
			<view class="content_text">
				<text>成立时间</text>
				<text style="color: red;">*</text>
			</view>
			<u-input class="content-input" v-model="form.birthday" :clearable="false" placeholder="请输入成立时间" type="number" />
		</view>
		<view class="content">
			<view class="content_text">
				<text>岗位数</text>
				<text style="color: red;">*</text>
			</view>
			<u-input class="content-input" v-model="form.post_num" :clearable="false" placeholder="请输入岗位数" type="number" />
		</view>
		<view class="content">
			<view class="content_text">
				<text>在岗人数</text>
				<text style="color: red;">*</text>
			</view>
			<u-input class="content-input" v-model="form.duty_num" :clearable="false" placeholder="请输入小区名字" type="number" />
		</view>
		<view class="content_remack">
			<view class="content_text_remack">
				<text>备注</text>
			</view>
			<textarea v-model="form.remark" class="content_area"/>
		</view>
		<view class="open_invoice" @click="submit">
			<text>提交</text>
		</view>
		<u-picker mode="birthday" v-model="show" @confirm="selectTime"></u-picker>
		<u-select v-model="showSelect" :list="list" @confirm="selectCommunity"></u-select>
		<u-select v-model="showHolds" :list="listHolds" @confirm="selectHolds"></u-select>
		<u-action-sheet :list="actionSheetList" v-model="showSex" @click="actionSheetCallback"></u-action-sheet>
		<u-top-tips ref="uTips"></u-top-tips>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				showSelect: false,
				showHolds: false,
				showSex: false,
				form: {
					birthday: '',
					// community: '',
					// holds: ''
				},
				list: [{
						value: '1',
						label: '金鹭小区'
					},
					{
						value: '2',
						label: '金贵小区'
					}
				],
				listHolds: [{
						value: '1',
						label: '家庭户'
					},
					{
						value: '2',
						label: '集体户'
					}
				],
				actionSheetList: [{
						text: '男'
					},
					{
						text: '女'
					},
					{
						text: '保密'
					}
				],
			}
		},
		onLoad(options) {
			console.log("xxxxxxxxxxx")
			console.log(options.item);
			var obj = JSON.parse(decodeURIComponent(options.item))
			console.log(obj)
			console.log(obj)
			console.log(obj)
			console.log("xxxxxxxxxxx")
			
		},
		methods: {
			selectTime(e) {
				this.form.time = e.year + '-' + e.month + '-' + e.day
				console.log(e)
			},
			selectCommunity(e) {
				this.form.community = e[0].label
			},
			selectHolds(e) {
				this.form.holds = e[0].label
			},
			submit() {
				if (!this.form.birthday) {
					this.$refs.uTips.show({
						title: '请选择成立日期',
						type: 'error',
						duration: '2000'
					})
				}
				uni.request({
					url: this.$common.baseUrl +'api/data/addCompany',
					data: this.form,
					method: 'POST',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					dataType: 'json',
					success: res=>{
						if (res.data.info == 200){
							this.$refs.uTips.show({
								title: '新增企业信息成功',
								type: 'success',
								duration: '2000'
							})
							uni.navigateBack({
								
							})
						}
					},
					fail: err=>{
							
					}
				})
			},
		}
	}
</script>

<style scoped>
	.title {
		height: 40rpx;
		width: 10rpx;
		background-color: #68B92E;
		margin: 20rpx 0 20rpx 20rpx;
	}

	.icon-title {
		display: block;
		line-height: 100rpx;
		padding-left: 10rpx;
		font-weight: bold;
	}

	.content {
		width: 95%;
		height: 80rpx;
		margin: 0 auto;
		background-color: #F7F7F7;
		border-radius: 15rpx;
		display: flex;
		align-items: center;
		margin-bottom: 10rpx;
	}

	.content_remack {
		width: 95%;
		height: 280rpx;
		margin: 0 auto;
		background-color: #F7F7F7;
		border-radius: 15rpx;
		margin-bottom: 10rpx;
	}

	.content_text {
		font-size: 26rpx;
		letter-spacing: 2rpx;
		margin-left: 30rpx;
		width: 200rpx;
		
	}
	.content_text_remack{
		font-size: 26rpx;
		letter-spacing: 2rpx;
		margin-left: 30rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
	}
	.content_area{
		width: 95%;
		margin: 0 auto;
		height: 200rpx;
	}
	.right {
		width: 50rpx;
	}

	.right image {
		width: 30rpx;
		height: 30rpx;
	}

	>>>.u-input {
		border: none !important;
	}

	.content-input {
		flex: 1 !important;
	}

	.open_invoice {
		width: 400rpx;
		height: 90rpx;
		background-color: #68B92E;
		text-align: center;
		border-radius: 15rpx;
		margin: 20rpx auto;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.open_invoice text {
		font-size: 25rpx;
		font-family: Source Han Serif CN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 20rpx;
		display: block;
	}
</style>
